package com.kevin.learn.vocabulary;

import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LearnLog {
	 private static Logger logger = LoggerFactory.getLogger(LearnLog.class);;

	    private static LearnLog instance = null;
	    
	    /////////////////////////////////////////////////////////////////////////////////
	    //内部函数
	    private LearnLog()
	    {
	    }
	    
	    /////////////////////////////////////////////////////////////////////////////////
	    //对外接口函数
	    public void init()
	    {
	    	PropertyConfigurator.configure("log4j.properties");
	    	logger.isInfoEnabled();
	    }
	    
	    public static LearnLog getInstance()
	    {
	    	if (instance == null)
	    	{
	    		instance = new LearnLog();
	    		instance.init();
	    	}
	    	return instance;
	    }
	   
	    public static void warn (String obj, Throwable e)
	    {
	        logger.warn(obj, e);
	    }
	    public static void error (String obj, Throwable e)
	    {
	    	e.printStackTrace();
	        logger.error(obj, e);
	    }
	    public static void error(String _msg)
	    {
	        logger.error(_msg);
	    }
	    public static void info (String _msg)
	    {
	        logger.info(_msg);
	    }
	    public static void warn(String _msg)
	    {
	        logger.warn(_msg);
	    }
	    public static void debug(String _msg)
	    {
	        logger.debug(_msg);
	    }
	    
}
